"use strict";

module.exports = {
    // 在执行数据库升级时调用的函数，创建 t_apps 表
    up: async (queryInterface, Sequelize) => {
        const { INTEGER, CHAR, DATE, STRING, UUID, UUIDV4 } = Sequelize;
        await queryInterface.createTable("t_app", {
            id: {
                type: UUID,
                primaryKey: false,
                allowNull: false,
                defaultValue: UUIDV4,
                comment: "id"
            },
            org_id: {
                type: UUID,
                primaryKey: true,
                allowNull: false,
            },
            app_name: { type: STRING(50), allowNull: false },
            apk: { type: STRING(50), allowNull: false },
            // status: { type: CHAR(3), allowNull: false, defaultValue:"000" },
            remark: { type: STRING(200), allowNull: true },
            create_user_id: { type: UUID, allowNull: true },
            modify_user_id: { type: UUID, allowNull: true },
            create_time: { type: DATE, allowNull: false },
            modify_time: { type:DATE, allowNull: false }
        });
    },
    // 在执行数据库降级时调用的函数，删除 t_apps 表
    down: async queryInterface => {
        await queryInterface.dropTable("t_app");
    }
};
